package com.dayou.controller;

import java.util.List;

import com.dayou.bean.Prisoner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.dayou.service.IPrisonerService;
import com.dayou.common.core.controller.BaseController;
import com.dayou.common.core.page.TableDataInfo;
import com.dayou.common.core.domain.AjaxResult;
import com.dayou.common.utils.poi.ExcelUtil;
import org.springframework.web.bind.annotation.RestController;

/**
 * 拘留人员基础 信息操作处理
 * 
 * @author dayou
 * @date 2020-04-29
 */
@RestController
@RequestMapping("/prisoner")
public class PrisonerController extends BaseController
{
	@Autowired
	private IPrisonerService basicsInfoService;

	/**
	 * 查询所有拘留人员基础列表
	 */
	@PostMapping("/listAll")
	@ResponseBody
	public TableDataInfo listAll(@RequestBody Prisoner prisoner)
	{
		startPage();
		List<Prisoner> list = basicsInfoService.selectPrisonerList(prisoner);
		return getDataTable(list);
	}

	/**
	 * 查询所有拘留人员基础列表
	 */
	@PostMapping("/listByIds")
	@ResponseBody
	public AjaxResult listByIds(@RequestParam String ids)
	{
		return AjaxResult.success(basicsInfoService.selectPrisonerByPrisonInIds(ids));
	}
	
	
	/**
	 * 导出拘留人员基础列表
	 */
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(Prisoner prisoner)
    {
    	List<Prisoner> list = basicsInfoService.selectPrisonerList(prisoner);
        ExcelUtil<Prisoner> util = new ExcelUtil<Prisoner>(Prisoner.class);
        return util.exportExcel(list, "prisoner");
    }
}
